﻿using LiteDB;
using SqlSugar;
using System;
using 历史记录.Helper;

namespace 历史记录
{
    public class Model
    {
        /// <summary>
        /// 写入时间 唯一Id
        /// </summary>
        [SugarColumn(IsPrimaryKey = true)]
        [BsonId]//主键标识
        public DateTime Id { get; set; }

        /// <summary>
        /// 数据序号筛选Id
        /// </summary>
        public uint Filtrate { get; set; }

        /// <summary>
        /// 写入状态  默认为 正常数据
        /// </summary>
        public WriteType State { get; set; }

        /// <summary>
        /// 获取表名
        /// </summary>
        /// <returns></returns>
        public string GetTable()
        {
            return Id.ToTableName();
        }
    }

    /// <summary>
    /// 写入类型
    /// </summary>
    public enum WriteType : byte
    {
        /// <summary>
        /// 正常的写入数据
        /// </summary>
        None,

        /// <summary>
        /// 开始记录标记
        /// </summary>
        Start,

        /// <summary>
        /// 结束记录标记
        /// </summary>
        End
    }
}